/**一份i2c_driver模板 demo
 *
 * */
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/mod_devicetable.h>
#include <linux/log2.h>
#include <linux/bitops.h>
#include <linux/jiffies.h>
#include <linux/of.h>
#include <linux/acpi.h>
#include <linux/i2c.h>
#include <linux/nvmem-provider.h>
#include <linux/platform_data/at24.h>

static int i2c_example_driver_probe(struct i2c_client *client)
{
    return 0; 
}
static int i2c_example_driver_remove(struct i2c_client *client)
{
    return 0;
}

static const struct of_device_id of_match_ids_example[] = {
	{ .compatible = "com_name,chip_name",   .data = NULL},
	{ /* END OF LIST */ }
};

static const struct i2c_device_id example_ids[] = {
	{ "chip_name",  (kernel_ulong_t)NULL },
	{ /* END OF LIST */ }
};
static struct i2c_driver i2c_example_driver = {
	.driver = {
		.name = "example",
		.of_match_table = of_match_ids_example,
	},
	.probe = i2c_example_driver_probe,
	.remove = i2c_example_driver_remove,
	.id_table = example_ids,
};

/**入口函数
 * 注册一个i2c_drvier
 * */
static int __init i2c_driver_init(void)
{
	return i2c_add_driver(&i2c_example_driver);
}
module_init(i2c_driver_init);

/**出口函数
 * del一个i2c_drvier
 * */
static void __exit i2c_driver_exit(void)
{
	i2c_del_driver(&i2c_example_driver);
}
module_exit(i2c_driver_exit);

MODULE_AUTHOR("huahui");
MODULE_LICENSE("GPL");
